package com.dragon.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExecuteCodeResponse {
    // 接口信息
    private String message;
    // 执行状态
    private Integer status; // 1 成功，0 失败
    // 判题信息
    private List<JudgeInfo> judgeInfoList;
    // 测试点总数
    private Integer testTotal;
    // 通过总数
    private Integer successTotal;
    // 编译失败信息
    private String compileMessage;
    // 文件大小
    private long fileSize;
    // 源代码
    private String sourceCode;

    public static ExecuteCodeResponse success(List<JudgeInfo> judgeInfo, Integer testTotal, Integer successTotal, long fileSize, String sourceCode){
        return new ExecuteCodeResponse("success",1, judgeInfo, testTotal, successTotal, null, fileSize, sourceCode);
    }
    public static ExecuteCodeResponse error(String message, long fileSize, String sourceCode){
        return new ExecuteCodeResponse(message,0,null,null,null,null , fileSize, sourceCode);
    }
    public static ExecuteCodeResponse compileError(String message,String compileMessage, String sourceCode){
        return new ExecuteCodeResponse(message,0,null,null,null, compileMessage,0, sourceCode);
    }

    public static ExecuteCodeResponse error(String message) {
        return new ExecuteCodeResponse(message,0,null,null,null,null , 0, null);
    }
}
